function getFormatDateTimeByStamp(stamp) {
  return getFormatDateTime(new Date(stamp))
}

function getFormatDateTimeByStamp_2(stamp) {
  return getFormatDateTime_2(new Date(stamp))
}

function getFormatDateByStamp(stamp) {
  return getFormatDate(new Date(stamp))
}

function getFormatHourMinuteByStamp(stamp) {
  return getFormatHourMinute(new Date(stamp))
}

function getFormatDateTime(date) {
  var month = date.getMonth() + 1
  var day = date.getDate()
  var hour = date.getHours()
  var minutes = date.getMinutes()
  var seconds = date.getSeconds()
  month = month < 10 ? '0' + month : month
  day = day < 10 ? '0' + day : day
  hour = hour < 10 ? '0' + hour : hour
  minutes = minutes < 10 ? '0' + minutes : minutes
  seconds = seconds < 10 ? '0' + seconds : seconds
  var currentDate = date.getFullYear() + '-' + month + '-' + day + ' ' + hour + ':' + minutes + ':' + seconds
  return currentDate
}

function getFormatDateTime_2(date) {
  date=date/1000
  var month = date.getMonth() + 1
  var day = date.getDate()
  var hour = date.getHours()
  var minutes = date.getMinutes()
  var seconds = date.getSeconds()
  month = month < 10 ? '0' + month : month
  day = day < 10 ? '0' + day : day
  hour = hour < 10 ? '0' + hour : hour
  minutes = minutes < 10 ? '0' + minutes : minutes
  seconds = seconds < 10 ? '0' + seconds : seconds
  var currentDate = date.getFullYear() + '-' + month + '-' + day + ' ' + hour + ':' + minutes + ':' + seconds
  return currentDate
}


function getFormatDate(date) {
  var month = date.getMonth() + 1
  var day = date.getDate()
  month = month < 10 ? '0' + month : month
  day = day < 10 ? '0' + day : day
  var currentDate = date.getFullYear() + '-' + month + '-' + day
  return currentDate
}

function getFormatHourMinute(date) {
  var hour = date.getHours()
  var minutes = date.getMinutes()
  hour = hour < 10 ? '0' + hour : hour
  minutes = minutes < 10 ? '0' + minutes : minutes
  var hourMinutes = hour + ':' + minutes
  return hourMinutes
}

function getFormatDateYearMonth(date) {
  const year = date.getFullYear()
  const month = (date.getMonth() + 1).toString().padStart(2, '0')
  const yearMonth = year + '-' + month
  return yearMonth
}

function getPreviousDayFormatDate() {
  const today = new Date();
  const previousDay = new Date(today.setDate(today.getDate() - 1));
  return getFormatDate(previousDay)
}

export { 
  getFormatDateTime, 
  getFormatDateTime_2,
  getFormatDate,
  getFormatDateTimeByStamp_2, 
  getFormatHourMinute, 
  getFormatDateTimeByStamp, 
  getFormatDateByStamp, 
  getFormatHourMinuteByStamp,
  getFormatDateYearMonth,
  getPreviousDayFormatDate
}
